<script type="text/javascript">
	if (document.namespaces) { // only needed in IE
		document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
	}
	//<![CDATA[
	URLbase = "[(#EVAL{_DIR_PLUGIN_GEOMAP}|url_absolue)]";
	URLbaseGis = "[(#EVAL{_DIR_PLUGIN_GIS}|url_absolue)]";
	//var numero = 1;
	[(#SET{id_carte_gis,#ENV{id_carte_gis,1}})]
	var map[(#GET{id_carte_gis})];
	var markerManager[(#GET{id_carte_gis})];
	<BOUCLE_centrado(GIS){id_article?}{id_rubrique ?}{0,1}>
	#SET{latitude,#ENV{latit,#CONFIG**{gis_default_lat,0}}}
	#SET{lonxitude,#ENV{lonxit,#CONFIG**{gis_default_lonx,0}}}
	#SET{zoommapa, #ENV{zoom,#CONFIG**{gis_default_zoom,0}}
	</BOUCLE_centrado>
	#SET{latitude,#ENV{latit,#CONFIG**{gis_default_lat,0}}}
	#SET{lonxitude,#ENV{lonxit,#CONFIG**{gis_default_lonx,0}}}
	#SET{zoommapa, #ENV{zoom,#CONFIG**{gis_default_zoom,0}}
	<//B_centrado>
	[(#SET{control,#ENV{control,'small'}})]
	[(#ENV{type}|=={'satellite'}|?{#SET{type,G_SATELLITE_MAP},''})]
	[(#ENV{type}|=={'carte'}|?{#SET{type,G_NORMAL_MAP},''})]
	[(#ENV{type}|=={'hybride'}|?{#SET{type,G_HYBRID_MAP},''})]
	[(#ENV{type}|=={'physique'}|?{#SET{type,G_PHYSICAL_MAP},''})]
	[(#ENV{type}|=={''}|?{#SET{type,G_SATELLITE_MAP},''})]
	
	function load[(#GET{id_carte_gis})]() {
		if (GBrowserIsCompatible()) {
			// facelo mapa
			map[(#GET{id_carte_gis})] = new GMap2(document.getElementById("map[(#GET{id_carte_gis})]"));
			[(#GET{control}|=={'custom'}|?{' '})
				[(#ENV{control_type}|!={'non'}|?{' '})
				map[(#GET{id_carte_gis})].addControl(new mapTypeControl());
				]
			]
			[(#GET{control}|=={'custom'}|?{' '})
				[(#ENV{control_zoom}|!={'non'}|?{' '})
				map[(#GET{id_carte_gis})].addControl(new mapZoomControl());
				]
			]
			[(#GET{control}|=={'custom'}|?{' '})
				[(#ENV{control_move}|!={'non'}|?{' '})
				map[(#GET{id_carte_gis})].addControl(new mapMoveControl());
				]
			]
			[(#GET{control}|=={'small'}|?{map[(#GET{id_carte_gis})].addControl(new GSmallMapControl());})]
			[(#GET{control}|=={'small'}|?{' '})
				[(#ENV{control_type}|!={'non'}|?{' '})
				map[(#GET{id_carte_gis})].addControl(new GMapTypeControl());
				]
			]
			[(#GET{control}|=={'large'}|?{map[(#GET{id_carte_gis})].addControl(new GLargeMapControl());})]
			[(#GET{control}|=={'large'}|?{' '})
				[(#ENV{control_type}|!={'non'}|?{' '})
				map[(#GET{id_carte_gis})].addControl(new GMapTypeControl());
				]
			]
			[(#ENV{rounded}|=={'true'}|?{map[(#GET{id_carte_gis})].addControl(new cornerControl());})]
			map[(#GET{id_carte_gis})].setCenter(new GLatLng(#GET{latitude}, #GET{lonxitude}), #GET{zoommapa}, #GET{type});
			centermap[(#GET{id_carte_gis})] = map[(#GET{id_carte_gis})].getCenter();
			map[(#GET{id_carte_gis})].enableDoubleClickZoom();
			map[(#GET{id_carte_gis})].enableContinuousZoom();
			markerManager[(#GET{id_carte_gis})] = new GMarkerManager(map[(#GET{id_carte_gis})]);
			
			// Chargement KML si attache a l'article
			<BOUCLE_kml_art(documents){id_article}{0,1}{extension=kml}>
			[(#ENV{id_article}|=={''}|?{'',
			var kml = new GGeoXml("[(#URL_DOCUMENT|url_absolue)]");
			map[(#GET{id_carte_gis})].addOverlay(kml)
			})]
			</BOUCLE_kml_art>
			
			// Chargement KML si attache a la rubrique
			<BOUCLE_kml_rub(documents){id_rubrique}{0,1}{extension=kml}>
			[(#ENV{id_rubrique}|=={''}|?{'',
			var kml = new GGeoXml("[(#URL_DOCUMENT|url_absolue)]");
			map[(#GET{id_carte_gis})].addOverlay(kml)
			})]
			</BOUCLE_kml_rub>
			<//B_kml_art>
			
			//leemo-lo documento dos marcadores
			[(#ENV{recursive}|=={1}|?{' ',''})
       			jQuery.get('[(#URL_PAGE{rss-gis-recursive})]', {[limit:(#ENV{limit, 50})][, id_rubrique:(#ID_RUBRIQUE)][, id_parent:(#ID_RUBRIQUE)][, id_secteur:(#ID_SECTEUR)][, id_mot:(#ID_MOT)][, id_auteur:(#ID_AUTEUR)][, recherche:(#RECHERCHE)][, id_article:(#ID_ARTICLE)][, id_groupe:(#ID_GROUPE)]}, function(xml[(#GET{id_carte_gis})]){
    		][(#ENV{recursive}|=={1}|?{'',' '})
				jQuery.get('[(#URL_PAGE{rss-gis})]', {[limit:(#ENV{limit, 50})][, id_rubrique:(#ID_RUBRIQUE)][, id_secteur:(#ID_SECTEUR)][, id_mot:(#ID_MOT)][, id_auteur:(#ID_AUTEUR)][, recherche:(#RECHERCHE)][, id_article:(#ID_ARTICLE)][, id_groupe:(#ID_GROUPE)]}, function(xml[(#GET{id_carte_gis})]){
			]
				//xml almacena en un objeto xml los datos recogidos del documento leido
    				jQuery("item", xml[(#GET{id_carte_gis})]).each(function(item[(#GET{id_carte_gis})]){
    					var xmlItem[(#GET{id_carte_gis})] = xml[(#GET{id_carte_gis})].documentElement.getElementsByTagName("item")[item[(#GET{id_carte_gis})]];
    					agregarMarcador(xmlItem[(#GET{id_carte_gis})],'[(#GET{id_carte_gis})]',0,17,markerManager[(#GET{id_carte_gis})]);
					});
					markerManager[(#GET{id_carte_gis})].refresh();
   				});
   			}
		}
		jQuery(document).ready(function(){
			load[(#GET{id_carte_gis})]();
		})
	//]]>
</script>
